package com.biubiushop.constant;

/**
 * redis中的key
 *
 * @author chenjia
 */
public class RedisKeyConstant {

    /**
     * 微信access_token
     */
    public static final String WX_ACCESS_TOKEN_KEY = "wxAccessTokenKey";

    /**
     * 获取用户登录时生成的token在redis中的key
     */
    public static String getUserToken(String userId) {
        String userToken = "userToken";
        return userToken + userId;
    }

    /**
     * 获取微信支付二次签名生成的签名在redis中的key
     */
    public static String getWxTwiceSign(String orderId) {
        String wxTwiceSign = "wxTwiceSign";
        return wxTwiceSign + orderId;
    }

    /**
     * 获取对应设备socketId在redis中的key
     */
    public static String getSocketIdKey(String equipmentId) {
        String perfix = "ID_SOCKETID_";
        return perfix + equipmentId;
    }

    /**
     * 获取对应设备state(状态)在redis中的key
     */
    public static String getEquipmentStateKey(String socketId) {
        String perfix = "SOCKETID_STATE_";
        return perfix + socketId;
    }

    /**
     * 获取用户登陆注册验证码在redis中的key
     */
    public static String getSmsVerificationCode(String phone, Integer type) {
        String registerSmsVerificationCode = "registerSmsVerificationCode";
        String loginSmsVerificationCode = "loginSmsVerificationCode";
        String forgetPwdSmsVerificationCode = "forgetPwdSmsVerificationCode";
        String forgetTradePwdSmsVerificationCode = "forgetTradePwdSmsVerificationCode";
        switch (type) {
            case 0:
                return registerSmsVerificationCode + phone;
            case 1:
                return loginSmsVerificationCode + phone;
            case 2:
                return forgetPwdSmsVerificationCode + phone;
            case 3:
                return forgetTradePwdSmsVerificationCode + phone;
            default:
                return null;
        }
    }

    /**
     * @param terminalSn 终端号
     * @return 收钱吧最新密钥的在redis中的key
     */
    public static String getShouQianbaTerminalSnKey(String terminalSn) {
        String perfix = "terminalSn";
        return perfix + terminalSn;
    }


    /**
     * redis - 手机登录验证码前缀
     */
    public final static String PHONE_LOGIN_CODE = "verify_code:plc:";

    /**
     * redis - 手机注册验证码前缀
     */
    public final static String PHONE_REGISTRY_CODE = "verify_code:prc:";

    /**
     * redis - 忘记登录密码验证码前缀
     */
    public final static String PHONE_FORGET_LOGIN_PWD_CODE = "verify_code:pfpc:";

}
